//
//  MACHeader.h
//  测试
//
//  Created by 李李善 on 2018/7/4.
//  Copyright © 2018年 李李善. All rights reserved.
//
//#ifdef __OBJC__

//#endif

#ifndef MACHeader_h
#define MACHeader_h

#import "MACDefines.h"
//#import "UIColor+HcdCustom.h"



/*************************
 大小设置
 *************************/

#ifndef kSysFont
#define kSysFont(s)              [UIFont systemFontOfSize:s]
#define kSysFontL(s)             [UIFont systemFontOfSize:s weight:UIFontWeightLight]
#define kSysFontR(s)             [UIFont systemFontOfSize:s weight:UIFontWeightRegular]
#define kSysFontB(s)             [UIFont systemFontOfSize:s weight:UIFontWeightBold]
#define kSysFontT(s)             [UIFont systemFontOfSize:s weight:UIFontWeightThin]
#endif


#define kScreenH             [[UIScreen mainScreen] bounds].size.height
#define kScreenW             [[UIScreen mainScreen] bounds].size.width

//不同屏幕尺寸字体适配（375，667是因为效果图为IPHONE6 如果不是则根据实际情况修改）//414 736
#define kScreenWidthRatio  (kScreenW / 375.0)
#define kScreenHeightRatio (kScreenH / 667.0)
//自动适配宽度、高度
#define kFitW(x)  ceilf((x) * kScreenWidthRatio)
#define kFitH(x)  ceilf((x) * kScreenHeightRatio)

#define WSELF(weakSelf) __weak typeof(self) weakSelf = self;
#define SSELF(strongSelf) __strong typeof(self) strongSelf = weakSelf;



/************************
 * 获取颜色
 *************************/
//通过指定RGB和透明度
#define RGBA(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
//明度
#define hexCOLOR(hexColor) [UIColor colorWithHexString: hexColor]



/**************************
 * GCD线程
 * BackgroundThreadPerformBlock  子线程运行block
 * MainThreadPerformBlock        主线程运行block
 * DelayMainThreadPerformBlock   主线程中延时secs秒后运行block
 *************************/
#ifndef BackgroundThreadPerformBlock
#define BackgroundThreadPerformBlock(block) dispatch_async(dispatch_queue_create(nil, DISPATCH_QUEUE_CONCURRENT), block)
#endif

#ifndef MainThreadPerformBlock
#define MainThreadPerformBlock(block) dispatch_async(dispatch_get_main_queue(),block)
#endif

#ifndef DelayMainThreadPerformBlock
#define DelayMainThreadPerformBlock(block,secs) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, secs * NSEC_PER_SEC), dispatch_get_main_queue(), block)
#endif


//字符串是否为空 返回Y N
#ifndef kStringIsEmpty
#define kStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
#endif


/*************************
 条件提示框
 *************************/
#define CHECK(_condition_,_error_) if (_condition_) {\
[self showMessage:_error_];\
return;\
}\

#define CHECKWeakSelf(_condition_,_error_) if (_condition_) {\
[weakSelf showMessage:_error_];\
return;\
}\

#define CHECK_VC(_condition_,_error_,vc) if (_condition_) {\
[vc showMessage:_error_];\
return;\
}\


#define CHECKCENTER(_condition_,_error_) if (_condition_) {\
[self showMessage:_error_];\
return;\
}\

#endif /* MACHeader_h */
